home *** CD-ROM | disk | FTP | other *** search
/ The X-Philes (2nd Revision) / The X-Philes Number 1 (1995).iso / xphiles / hp48_1 / pubdom.tar / pubdom / e_vogel / inct < prev    next >
Text File  |  1990-05-19  |  4KB  |  60 lines

  1. %%HP: T(3)A(D)F(.);                        @ INCT: add a temperature increment
  2.                                            @ to a point on a temperature scale,
  3.                                            @ and get a new point.
  4. \<<                                        @ tpt1 tinc ->
  5.   \-> tpt1 tinc                            @ Save arguments (user-defined 
  6.                                            @ function structure allows INCT  
  7.                                            @ to be used in an algebraic)
  8.   \<<                                      @ ->
  9.     tpt1 tinc                              @ Restore arguments
  10.                                            @ tpt1 tinc ->
  11.     IF                                     @ Check for real arguments
  12.       DUP2                                 @ tpt1 tinc tpt1 tinc ->
  13.       TYPE                                 @ tpt1 tinc tpt1 TYPE(tinc) ->
  14.       SWAP TYPE                            @ tpt1 tinc TYPE(tinc) TYPE(tpt1) ->
  15.       +                                    @ Sum will be zero if both real ->
  16.                                            @ tpt1 tinc 0/nonzero ->
  17.     THEN                                   @ Not 0: assume 2 pure temperatures
  18.                                            @ tpt1 tinc ->
  19.                                            @ To check for pure temperatures, 
  20.                                            @ call VFTOBJ or VFTERR here
  21.       OBJ\->                               @ Decompose tinc
  22.                                            @ tpt1 N(tinc) U(tinc) ->
  23.       ROT                                  @ N(tinc) U(tinc) tpt1 ->
  24.       OBJ\->                               @ Decompose tpt1
  25.                                            @ N(tinc) U(tinc) N(tpt1) U(tpt1) ->
  26.       \-> ntinc utinc ntpt1 utpt1          @ Save for later
  27.       \<<                                  @ ->
  28.         { '1_\^oC' '1_K' } DUP             @ {K scale} {K scale} ->
  29.         IF                                 @ Test if on same scale
  30.           utpt1 POS SWAP                   @ tpt1 on Kelvin scale?
  31.                                            @ tpt1pos {K scale} ->
  32.           utinc POS                        @ tinc on Kelvin scale?
  33.                                            @ tpt1pos tincpos ->
  34.           OVER                             @ tpt1pos tincpos tpt1pos ->
  35.           XOR                              @ tpt1pos bothpos ->
  36.         THEN                               @ Not on same scale
  37.           1.8                              @ scalefactor=1.8
  38.                                            @ tpt1pos 1.8 ->
  39.           IF                               @ tpt1 on Kelvin scale?
  40.             SWAP                           @ 1.8 tpt1pos ->
  41.           THEN                             @ Yes: scalefactor=1/1.8
  42.             INV                            @ 1/1.8 ->
  43.           END                              @ 1.8 or 1/1.8 ->
  44.         ELSE                               @ On same scale
  45.                                            @ tpt1pos
  46.           DROP 1                           @ scalefactor=1
  47.         END                                @ scalefactor ->
  48.         ntinc *                            @ N(tinc)*scalefactor ->
  49.         ntpt1 +                            @ N(tpt1)+N(tinc)*scalefactor ->
  50.         utpt1 \->UNIT                      @ Build unit object
  51.                                            @ inct ->
  52.       \>>
  53.     ELSE                                   @ 0: 2 reals, so just add
  54.                                            @ tpt1 tinc ->
  55.       +                                    @ tpt1+tinc ->
  56.                                            @ inct ->
  57.     END                                    
  58.   \>>
  59. \>>
  60.